from django.db import models

# Create your models here.


class BossModel(models.Model):

    name = models.CharField(max_length=30)
    price = models.DecimalField(max_digits=7,decimal_places=2,default=0)

    class Meta:
        db_table = 'boss'


class UserModel(models.Model):

    name = models.CharField(max_length=30)
    type = models.BooleanField(default=0)
    money = models.DecimalField(max_digits=7,decimal_places=2,default=0)

    class Meta:
        db_table = 'user'

class EatModel(models.Model):


    name = models.CharField(max_length=20)
    type = models.IntegerField(default=1)
    price = models.DecimalField(max_digits=7,decimal_places=2,default=0)


    class Meta:
        db_table = 'eat'



class TimeModel(models.Model):

    user = models.ForeignKey(UserModel,on_delete=models.CASCADE,null=True,blank=True)
    boss = models.ForeignKey(BossModel,on_delete=models.CASCADE,null=True,blank=True)
    start = models.DateTimeField(auto_now_add=True)
    end = models.DateTimeField(null=True)
    money = models.DecimalField(max_digits=7,decimal_places=2,default=0)
    count = models.IntegerField(default=0)

    class Meta:
        db_table = 'time'
